<template>
  <div class="content" @click="send">
    <div class="side-node-pic" :style="{ backgroundImage: 'url(http://www.xsitg.com.cn/emission/' + img + ')' }"></div>
    <div class="name">{{ name }}</div>
    <div class="danwei">{{ dan }}</div>
  </div>
</template>

<script>
export default {
  props: {
    name: {
      type: String
    },
    dan: {
      type: String,
      default: "kg"
    },
    // img:{
    //   type: String,
    //   default:"s1.png"
    // }
  },
  data() {
    return {
      img: ''
    }
  },
  mounted() {
    this.img = "s" + this.getRandomInt(4, 13) + ".png"
  },
  methods: {
    send() {
      this.$emit("clickt", this.name)
    },
    getRandomInt(min, max) {
      min = Math.ceil(min);
      max = Math.floor(max);
      return Math.floor(Math.random() * (max - min + 1) + min);
    }
  }
}
</script>

<style scoped>
.side-node-pic {
  position: absolute;
  left: 20px;
  top: 10px;
  width: 40px;
  height: 40px;

  background-size: 100% 100%;
}

.content {
  position: relative;
  z-index: 10;
  background-color: #fff;
  height: 60px;
  width: 90%;
  text-align: center;
  margin: 0 auto;
  border-radius: 8px;
  border-radius: 8px;
  box-shadow: 0 0 10px 0 rgb(0 0 0 / 10%);
  cursor: pointer;
  padding: 20px;
}

.content:hover {
  /* z-index: 10;
  background-color: #fff ;
  min-height: 60px;
  width: 90%;
  text-align: center;
  margin: 0 auto; */
  box-shadow: 0 0 16px 0 rgb(106 184 157 / 60%);
  cursor: pointer;
  padding: 20px;
  border-bottom-right-radius: 20px;
  border-top-left-radius: 20px;
  border-bottom-left-radius: 10px;
  border-top-right-radius: 10px;
  font-size: 18px;
}

.name {
  margin-left: -100px;

}

.danwei {
  position: absolute;
  margin-left: -100px;
  right: 50px;
  top: 20px;
}
</style>
